home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Prog / T / Think-Pascal-7.0.cpt / THINK Pascal Interfaces / StandardFile.p < prev    next >
Encoding:
Text File  |  1991-04-03  |  5.7 KB  |  164 lines  |  [TEXT/PJMM]

  1. {    This file has been processed by The THINK Pascal Source Converter, v1.1.    }
  2.  
  3. {}
  4. {Created: Sunday, January 6, 1991 at 11:19 PM}
  5. {    StandardFile.p}
  6. {    Pascal Interface to the Macintosh Libraries}
  7. {}
  8. {        Copyright Apple Computer, Inc.    1990}
  9. {        All rights reserved}
  10. {}
  11. {}
  12.  
  13.  
  14.  
  15. {    RMS    4/3/91        Modified to exclude declarations already in the THINK Pascal built-in interfaces    }
  16.  
  17.  
  18. unit StandardFile;
  19. interface
  20.     uses
  21.         Types, OSUtils, Files, Dialogs;
  22.  
  23.     const
  24. { resource IDs and item offsets of 7.0 dialogs }
  25.         sfPutDialogID = -6043;
  26.         sfGetDialogID = -6042;
  27.         sfItemOpenButton = 1;
  28.         sfItemCancelButton = 2;
  29.         sfItemBalloonHelp = 3;
  30.         sfItemVolumeUser = 4;
  31.         sfItemEjectButton = 5;
  32.         sfItemDesktopButton = 6;
  33.         sfItemFileListUser = 7;
  34.         sfItemPopUpMenuUser = 8;
  35.         sfItemDividerLinePict = 9;
  36.         sfItemFileNameTextEdit = 10;
  37.         sfItemPromptStaticText = 11;
  38.         sfItemNewFolderUser = 12;
  39.  
  40. { pseudo-item hits for use in DlgHook }
  41.         sfHookFirstCall = -1;
  42.         sfHookCharOffset = $1000;
  43.         sfHookNullEvent = 100;
  44.         sfHookRebuildList = 101;
  45.         sfHookFolderPopUp = 102;
  46.         sfHookOpenFolder = 103;
  47.  
  48. { the following are only in system 7.0+ }
  49.         sfHookOpenAlias = 104;
  50.         sfHookGoToDesktop = 105;
  51.         sfHookGoToAliasTarget = 106;
  52.         sfHookGoToParent = 107;
  53.         sfHookGoToNextDrive = 108;
  54.         sfHookGoToPrevDrive = 109;
  55.         sfHookChangeSelection = 110;
  56.         sfHookSetActiveOffset = 200;
  57.         sfHookLastCall = -2;
  58.  
  59. { the refcon field of the dialog record during a}
  60. { modalfilter or dialoghook contains one of the following}
  61.         sfMainDialogRefCon = 'stdf';
  62.         sfNewFolderDialogRefCon = 'nfdr';
  63.         sfReplaceDialogRefCon = 'rplc';
  64.         sfStatWarnDialogRefCon = 'stat';
  65.         sfLockWarnDialogRefCon = 'lock';
  66.         sfErrorDialogRefCon = 'err ';
  67.  
  68.     type
  69.         StandardFileReply = record
  70.                 sfGood: BOOLEAN;
  71.                 sfReplacing: BOOLEAN;
  72.                 sfType: OSType;
  73.                 sfFile: FSSpec;
  74.                 sfScript: ScriptCode;
  75.                 sfFlags: INTEGER;
  76.                 sfIsFolder: BOOLEAN;
  77.                 sfIsVolume: BOOLEAN;
  78.                 sfReserved1: LONGINT;
  79.                 sfReserved2: INTEGER;
  80.             end;
  81.  
  82.  
  83.         DlgHookProcPtr = ProcPtr;           { FUNCTION Hook(item: INTEGER; theDialog: DialogPtr): INTEGER; }
  84.         FileFilterProcPtr = ProcPtr;        { FUNCTION FileFilter(PB: CInfoPBPtr): BOOLEAN; }
  85.  
  86. { the following also include an extra parameter of "your data pointer" }
  87.         DlgHookYDProcPtr = ProcPtr;         { FUNCTION  Hook(item: INTEGER; theDialog: DialogPtr; yourDataPtr: Ptr): INTEGER; }
  88.         ModalFilterYDProcPtr = ProcPtr;     { FUNCTION  Filter(theDialog: DialogPtr; VAR theEvent: EventRecord; VAR itemHit: INTEGER; yourDataPtr: Ptr): BOOLEAN; }
  89.         FileFilterYDProcPtr = ProcPtr;      { FUNCTION  FileFilter(PB: CInfoPBPtr; yourDataPtr: Ptr): BOOLEAN; }
  90.         ActivateYDProcPtr = ProcPtr;        { PROCEDURE Activate(theDialog; DialogPtr; itemNo: INTEGER; activating: BOOLEAN; yourDataPtr: Ptr); }
  91.  
  92.         SFTypeList = array[0..3] of OSType;
  93.  
  94.     procedure SFPutFile (where: Point; prompt: Str255; origName: Str255; dlgHook: DlgHookProcPtr; var reply: SFReply);
  95.     inline
  96.         $3F3C, $0001, $A9EA;
  97.  
  98.     procedure SFGetFile (where: Point; prompt: Str255; fileFilter: FileFilterProcPtr; numTypes: INTEGER; typeList: SFTypeList; dlgHook: DlgHookProcPtr; var reply: SFReply);
  99.     inline
  100.         $3F3C, $0002, $A9EA;
  101.  
  102.     procedure SFPPutFile (where: Point; prompt: Str255; origName: Str255; dlgHook: DlgHookProcPtr; var reply: SFReply; dlgID: INTEGER; filterProc: ModalFilterProcPtr);
  103.     inline
  104.         $3F3C, $0003, $A9EA;
  105.  
  106.     procedure SFPGetFile (where: Point; prompt: Str255; fileFilter: FileFilterProcPtr; numTypes: INTEGER; typeList: SFTypeList; dlgHook: DlgHookProcPtr; var reply: SFReply; dlgID: INTEGER; filterProc: ModalFilterProcPtr);
  107.     inline
  108.         $3F3C, $0004, $A9EA;
  109.  
  110.     procedure StandardPutFile (prompt: Str255; defaultName: Str255; var reply: StandardFileReply);
  111.     inline
  112.         $3F3C, $0005, $A9EA;
  113.  
  114.     procedure StandardGetFile (fileFilter: FileFilterProcPtr; numTypes: INTEGER; typeList: SFTypeList; var reply: StandardFileReply);
  115.     inline
  116.         $3F3C, $0006, $A9EA;
  117.  
  118.     procedure CustomPutFile (prompt: Str255; defaultName: Str255; var reply: StandardFileReply; dlgID: INTEGER; where: Point; dlgHook: DlgHookYDProcPtr; filterProc: ModalFilterYDProcPtr; activeList: Ptr; activateProc: ActivateYDProcPtr; yourDataPtr: univ Ptr);
  119.     inline
  120.         $3F3C, $0007, $A9EA;
  121.  
  122.     procedure CustomGetFile (fileFilter: FileFilterYDProcPtr; numTypes: INTEGER; typeList: SFTypeList; var reply: StandardFileReply; dlgID: INTEGER; where: Point; dlgHook: DlgHookYDProcPtr; filterProc: ModalFilterYDProcPtr; activeList: Ptr; activateProc: ActivateYDProcPtr; yourDataPtr: univ Ptr);
  123.     inline
  124.         $3F3C, $0008, $A9EA;
  125.  
  126.  
  127. { }
  128. {    New StandardFile routine comments:}
  129. {}
  130. {    activeList is pointer to array of integer (16-bits).}
  131. {    first integer is length of list.}
  132. {    following integers are possible activatable DITL items, in}
  133. {    the order that the tab key will cycle through.  The first}
  134. {    in the list is the item made active when dialog is first shown.}
  135. {}
  136. {    activateProc is a pointer to a procedure like:}
  137. {}
  138. {        PROCEDURE MyActivateProc(theDialog:     DialogPtr;}
  139. {                                 itemNo:        INTEGER;}
  140. {                                 activating:    BOOLEAN;}
  141. {                                 yourDataPtr:    Ptr);}
  142. {}
  143. {    The activateProc is called with activating=FALSE on the itemNo}
  144. {    about to deactivate then with activating=TRUE on the itemNo}
  145. {    about to become the active item. (like activate event)}
  146. {}
  147. {    yourDataPtr is a nice little extra that makes life easier without}
  148. {    globals.  CustomGetFile & CustomPPutFile when calling any of their}
  149. {    call back procedures, pushes the extra parameter of yourDataPtr on}
  150. {    the stack.}
  151. {}
  152. {    In addition the filterProc in CustomGetFile & CustomPPutFile is called}
  153. {    before before SF does any mapping, instead of after.}
  154. {}
  155.  
  156.  
  157.  
  158.     { UsingStandardFile }
  159.  
  160.  
  161. implementation
  162. end.
  163.  
  164.